package com.example.mobile2021606129ly0608;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toast;

import com.example.mobile2021606129ly0608.util.AllSense;
import com.example.mobile2021606129ly0608.util.HttpUtil;
import com.google.gson.Gson;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
     HttpUtil.asynRequest(new HttpUtil.AsynCallBack() {
         @Override
         public void onFailure(Exception e) {

         }

         @Override
         public void onResponse(String json) {
       Toast.makeText(MainActivity.this,json, Toast.LENGTH_SHORT).show();
         }
         },"get_road_status",new String[]{"RoadID","UserName"},1,"user1");
     }
    }
//        new Timer().schedule(new TimerTask() {
//            @Override
//            public void run() {
//                HttpUtil.asymcRequest(new HttpUtil.AsynCallBack() {
//                    @Override
//                    public void onFailure(Exception e) {
//                    }
//
//                    @Override
//                    public void onResponse(String json) {
//                        AllSense bean = new Gson().fromJson(json, AllSense.class);
//                        Toast.makeText(MainActivity.this, bean.getERRMSG(), Toast.LENGTH_SHORT).show();
//                    }
//                }, "get_all_sence", new String[]{"UserName"}, "user1");
//            }
//        },0,3000);
//
//        }
//
//}